#pragma once

#include "fxcc/core/pch.h"
#include "fxcc/core/graph/common/ImageMipmap.h"

#include <gli/gli.hpp> 
#include <gli/generate_mipmaps.hpp> 

struct FXCC_API  gliUtils
{
    struct FXCC_API Image2DDSTask {
        int m_TargetWidth = { 1024 };
        int m_TargetHeight = { 1024 };
        int m_TargetLevels = { 11 };
        std::map<int, fxcc::graph::common::ImageMipmap::Desc> m_Images;
        bool m_GenerateMipmaps{ false };
        gli::filter m_Filter{ gli::filter::FILTER_NEAREST };
        int m_BaseFace{ 0 };
        int m_MaxFace{ 11 };
        std::string m_TargetPath;
    };

    struct FXCC_API Image2CubeTask {
        int m_TargetWidth = { 1024 };
        int m_TargetHeight = { 1024 };
        int m_TargetLevels = { 5 };
        std::map<int, fxcc::graph::common::ImageMipmap::Desc> m_FacesImages[6];
        bool m_GenerateMipmaps{ false };
        int m_BaseFace{ 0 };
        int m_MaxFace{ 5 };
        int m_BaseLevel{ 0 };
        int m_MaxLevel{ 4 };
        gli::filter m_Filter{ gli::filter::FILTER_NEAREST };

        std::string m_TargetPath;
    };

    struct FXCC_API Image2dds3DTask {
        int m_TargetWidth = { 1024 };
        int m_TargetHeight = { 1024 };
        int m_TargetDepth = { 6 };
        int m_TargetLevels = { 11 };
        std::map<int, fxcc::graph::common::ImageMipmap::Desc> m_Images;

        // Create mipmaps
        bool m_GenerateMipmaps{ false };
        gli::filter m_Filter{ gli::filter::FILTER_NEAREST };
        int m_BaseLevel{ 0 };
        int m_MaxLevel{ 4 };

        std::string m_TargetPath;
    };

    static bool Create3DFromSTBS(const Image2dds3DTask& task);

    static bool CreateCubeFromSTBS(const Image2CubeTask& task);
   
    static bool CreateDDSFronSTB(const Image2DDSTask& task);

    static gli::format GetFormat(const int nrComponet, const int hdr);
    
};